import scrapy
import time

class BiliSpider(scrapy.Spider):
    name='bili3'

    start_urls=['https://www.bilibili.com/video/BV1yPZmYZEvR/']
    base_url='https://www.bilibili.com'
    link_sets=set()
    up_name='音乐私藏馆'

    def parse(self,response):
        links=response.css('.rec-list .video-page-card-small').getall()
        print('**************************************\n'*3)
        self.logger.error(str(links))
        # print(link)
        for i in links:
            if i.css('.upname .name::text').get()==self.up_name:
                link=i.css('.pic .video-awesome-img::attr(href)')
                b=link.split('/')
                b='/'.join(b[:3])
                if b not in self.link_sets:
                    self.link_sets.add(b)
                    with open('bili.txt','a',encoding='utf-8') as f:
                        f.write(self.base_url+b+'\n')
            # f.write(str(response.text))
        # time.sleep(300000)
        yield {
            
        }